<!DOCTYPE HTML>
<html lang="zh-hans" >
    <!-- Start book Linux -->
<!-- Start book Linux -->
    <head>
        <!-- head:start -->
<!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>vim编辑器 | Linux</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        <meta name="author" content="chris Jiang">
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="gitbook/style.css">
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-prism/prism.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="./chapter05.html" />
    
    
    <link rel="prev" href="./chapter03.html" />
    

        <!-- head:end -->
<!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
<!-- body:start -->
        
    <div class="book"
        data-level="4"
        data-chapter-title="vim编辑器"
        data-filepath="chapter04.md"
        data-basepath="."
        data-revision="Mon Sep 30 2019 00:13:13 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="./index.html">
                
                        <i class="fa fa-check"></i>
                        
                        学习目标
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="chapter01.html">
            
                
                    <a href="./chapter01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        Linux入门
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="01/section01.html">
            
                
                    <a href="./01/section01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        操作系统介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="01/section02.html">
            
                
                    <a href="./01/section02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        Linux系统介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="01/section03.html">
            
                
                    <a href="./01/section03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        使用虚拟机安装Ubuntu
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="01/section04.html">
            
                
                    <a href="./01/section04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        使用U盘安装双系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="01/section05.html">
            
                
                    <a href="./01/section05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        配置Linux系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="01/section06.html">
            
                
                    <a href="./01/section06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        Linux启动流程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="01/section07.html">
            
                
                    <a href="./01/section07.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        远程连接Linux
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="chapter02.html">
            
                
                    <a href="./chapter02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        软件安装相关指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3" data-path="chapter03.html">
            
                
                    <a href="./chapter03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        文件系统
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="4" data-path="chapter04.html">
            
                
                    <a href="./chapter04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        vim编辑器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5" data-path="chapter05.html">
            
                
                    <a href="./chapter05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        目录操作的常见指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6" data-path="chapter06.html">
            
                
                    <a href="./chapter06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        python、pip和ipython的安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7" data-path="chapter07.html">
            
                
                    <a href="./chapter07.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        虚拟环境管理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8" data-path="chapter08.html">
            
                
                    <a href="./chapter08.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        用户管理相关指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9" data-path="chapter09.html">
            
                
                    <a href="./chapter09.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        权限管理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10" data-path="chapter10.html">
            
                
                    <a href="./chapter10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                        压缩解压命令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11" data-path="chapter11.html">
            
                
                    <a href="./chapter11.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.</b>
                        
                        服务监听
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12" data-path="chapter12.html">
            
                
                    <a href="./chapter12.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.</b>
                        
                        管道和重定向
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="13" data-path="chapter13.html">
            
                
                    <a href="./chapter13.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>13.</b>
                        
                        Nginx的安装和配置
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14" data-path="chapter14.html">
            
                
                    <a href="./chapter14.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.</b>
                        
                        Git的使用
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="14.1" data-path="14/section01.html">
            
                
                    <a href="./14/section01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.1.</b>
                        
                        git本地和远端管理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14.2" data-path="14/section02.html">
            
                
                    <a href="./14/section02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.2.</b>
                        
                        冲突的介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14.3" data-path="14/section03.html">
            
                
                    <a href="./14/section03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.3.</b>
                        
                        分支操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14.4" data-path="14/section04.html">
            
                
                    <a href="./14/section04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.4.</b>
                        
                        远端服务器的SSH连接
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="15" data-path="chapter15.html">
            
                
                    <a href="./chapter15.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>15.</b>
                        
                        shell编程
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    本书使用 GitBook 发布
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="./" >Linux</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h2 id="vim&#x7684;&#x4F7F;&#x7528;">vim&#x7684;&#x4F7F;&#x7528;</h2>
<p>Vim&#x662F;&#x4E00;&#x4E2A;&#x7C7B;&#x4F3C;&#x4E8E;Vi&#x7684;&#x8457;&#x540D;&#x7684;&#x529F;&#x80FD;&#x5F3A;&#x5927;&#x3001;&#x9AD8;&#x5EA6;&#x53EF;&#x5B9A;&#x5236;&#x7684;&#x6587;&#x672C;&#x7F16;&#x8F91;&#x5668;&#xFF0C;&#x5728;Vi&#x7684;&#x57FA;&#x7840;&#x4E0A;&#x6539;&#x8FDB;&#x548C;&#x589E;&#x52A0;&#x4E86;&#x5F88;&#x591A;&#x7279;&#x6027;&#x3002;</p>
<h3 id="&#x5B89;&#x88C5;">&#x5B89;&#x88C5;</h3>
<pre><code>sudo apt-get install vim
</code></pre><h3 id="&#x4F7F;&#x7528;">&#x4F7F;&#x7528;</h3>
<p>vim &#x6709;&#x4E09;&#x79CD;&#x5DE5;&#x4F5C;&#x6A21;&#x5F0F;&#xFF1A;&#x547D;&#x4EE4;&#x6A21;&#x5F0F;&#xFF0C;&#x8F93;&#x5165;&#x6A21;&#x5F0F;&#x548C;&#x7F16;&#x8F91;&#x6A21;&#x5F0F;&#x3002;</p>
<p>!v : &#x6253;&#x5F00;&#x6700;&#x540E;&#x4F7F;&#x7528;vim&#x6253;&#x5F00;&#x7684;&#x6587;&#x4EF6;</p>
<p>vim filename : &#x6253;&#x5F00;/&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;</p>
<ul>
<li>&#x547D;&#x4EE4;&#x6A21;&#x5F0F;&#xFF1A;&#x6309;Esc&#x952E;&#x5207;&#x6362;&#x5230;&#x547D;&#x4EE4;&#x6A21;&#x5F0F;</li>
</ul>
<table>
<thead>
<tr>
<th>&#x547D;&#x4EE4;/&#x64CD;&#x4F5C;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>ZZ&#xFF08;shift + zz&#xFF09;</td>
<td>&#x4FDD;&#x5B58;&#x9000;&#x51FA;</td>
</tr>
<tr>
<td>&#x5149;&#x6807;&#x5B9A;&#x4F4D;</td>
<td></td>
</tr>
<tr>
<td>vim filename +n</td>
<td>&#x6253;&#x5F00;&#x6587;&#x4EF6;&#xFF0C;&#x5C06;&#x5149;&#x6807;&#x5B9A;&#x4F4D;&#x5230;&#x7B2C;n&#x884C;</td>
</tr>
<tr>
<td>vim filename +</td>
<td>&#x6253;&#x5F00;&#x6587;&#x4EF6;&#xFF0C;&#x5C06;&#x5149;&#x6807;&#x5B9A;&#x4F4D;&#x5230;&#x6700;&#x540E;&#x4E00;&#x884C;</td>
</tr>
<tr>
<td>gg</td>
<td>&#x5B9A;&#x4F4D;&#x5230;&#x9996;&#x884C;</td>
</tr>
<tr>
<td>G</td>
<td>&#x5B9A;&#x4F4D;&#x5230;&#x5C3E;&#x884C;</td>
</tr>
<tr>
<td>ngg</td>
<td>&#x5B9A;&#x4F4D;&#x5230;&#x7B2C;n&#x884C;</td>
</tr>
<tr>
<td>^/0</td>
<td>&#x5B9A;&#x4F4D;&#x5230;&#x884C;&#x9996;</td>
</tr>
<tr>
<td>$</td>
<td>&#x5B9A;&#x4F4D;&#x5230;&#x884C;&#x5C3E;</td>
</tr>
<tr>
<td>k</td>
<td>&#x2191;</td>
</tr>
<tr>
<td>j</td>
<td>&#x2193;</td>
</tr>
<tr>
<td>h</td>
<td>&#x2190;</td>
</tr>
<tr>
<td>l</td>
<td>&#x2192;</td>
</tr>
<tr>
<td>ctrl + f</td>
<td>&#x4E0B;&#x7FFB;&#x4E00;&#x9875;</td>
</tr>
<tr>
<td>ctrl + b</td>
<td>&#x4E0A;&#x7FFB;&#x4E00;&#x9875;</td>
</tr>
<tr>
<td>ctrl + d</td>
<td>&#x4E0B;&#x7FFB;&#x534A;&#x9875;</td>
</tr>
<tr>
<td>ctrl + u</td>
<td>&#x4E0A;&#x7FFB;&#x534A;&#x9875;</td>
</tr>
<tr>
<td>&#x5185;&#x5BB9;&#x5904;&#x7406;</td>
<td></td>
</tr>
<tr>
<td>x</td>
<td>&#x5411;&#x53F3;&#x5220;&#x9664;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;</td>
</tr>
<tr>
<td>nx</td>
<td>&#x5411;&#x53F3;&#x5220;&#x9664;n&#x4E2A;&#x5B57;&#x7B26;&#xFF0C;n&#x8868;&#x793A;&#x4E2A;&#x6570;</td>
</tr>
<tr>
<td>X</td>
<td>&#x5411;&#x5DE6;&#x5220;&#x9664;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;</td>
</tr>
<tr>
<td>nX</td>
<td>&#x5411;&#x5DE6;&#x5220;&#x9664;n&#x4E2A;&#x5B57;&#x7B26;&#xFF0C;n&#x8868;&#x793A;&#x4E2A;&#x6570;</td>
</tr>
<tr>
<td>dd</td>
<td>&#x5220;&#x9664;&#x5149;&#x6807;&#x6240;&#x5728;&#x884C;</td>
</tr>
<tr>
<td>ndd</td>
<td>&#x5220;&#x9664;&#x5149;&#x6807;&#x5F00;&#x59CB;&#x7684;n&#x884C;</td>
</tr>
<tr>
<td>p</td>
<td>&#x7C98;&#x8D34;&#x526A;&#x5207;&#x677F;&#x4E2D;&#x7684;&#x5185;&#x5BB9;</td>
</tr>
<tr>
<td>yy</td>
<td>&#x590D;&#x5236;&#x5149;&#x6807;&#x6240;&#x5728;&#x884C;</td>
</tr>
<tr>
<td>nyy</td>
<td>&#x590D;&#x5236;&#x5149;&#x6807;&#x5F00;&#x59CB;&#x7684;n&#x884C;</td>
</tr>
<tr>
<td>u</td>
<td>&#x64A4;&#x9500;</td>
</tr>
<tr>
<td>ctrl + r</td>
<td>&#x53CD;&#x64A4;&#x9500;</td>
</tr>
</tbody>
</table>
<ul>
<li>&#x8F93;&#x5165;&#x6A21;&#x5F0F;&#xFF1A;</li>
</ul>
<table>
<thead>
<tr>
<th>&#x547D;&#x4EE4;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>i</td>
<td>&#x5728;&#x5149;&#x6807;&#x4F4D;&#x7F6E;&#x63D2;&#x5165;</td>
</tr>
<tr>
<td>I</td>
<td>&#x5728;&#x7B2C;&#x4E00;&#x4E2A;&#x975E;&#x7A7A;&#x5B57;&#x7B26;&#x63D2;&#x5165;</td>
</tr>
<tr>
<td>a</td>
<td>&#x5728;&#x5149;&#x6807;&#x7684;&#x4E0B;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x8F93;&#x5165;</td>
</tr>
<tr>
<td>A</td>
<td>&#x5728;&#x884C;&#x5C3E;&#x63D2;&#x5165;</td>
</tr>
<tr>
<td>o</td>
<td>&#x5728;&#x5149;&#x6807;&#x6240;&#x5728;&#x7684;&#x884C;&#x4E0B;&#x9762;&#x63D2;&#x5165;&#x7A7A;&#x884C;</td>
</tr>
<tr>
<td>O</td>
<td>&#x5728;&#x5149;&#x6807;&#x6240;&#x5728;&#x7684;&#x884C;&#x4E0A;&#x9762;&#x63D2;&#x5165;&#x7A7A;&#x884C;</td>
</tr>
<tr>
<td>s</td>
<td>&#x5220;&#x9664;&#x5149;&#x6807;&#x6240;&#x5728;&#x5B57;&#x7B26;&#xFF0C;&#x5E76;&#x8FDB;&#x5165;&#x8F93;&#x5165;&#x6A21;&#x5F0F;</td>
</tr>
<tr>
<td>S</td>
<td>&#x5220;&#x9664;&#x5149;&#x6807;&#x6240;&#x5728;&#x884C;&#xFF0C;&#x5E76;&#x8FDB;&#x5165;&#x8F93;&#x5165;&#x6A21;&#x5F0F;</td>
</tr>
</tbody>
</table>
<ul>
<li>&#x7F16;&#x8F91;&#x6A21;&#x5F0F;&#xFF1A;&#x5728;&#x547D;&#x4EE4;&#x6A21;&#x5F0F;&#x4E0B;&#xFF0C;&#x6309; : &#x952E;&#x8FDB;&#x5165;&#x5230;&#x7F16;&#x8F91;&#x6A21;&#x5F0F;&#x3002;</li>
</ul>
<table>
<thead>
<tr>
<th>&#x547D;&#x4EE4;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>:w</td>
<td>&#x4FDD;&#x5B58;</td>
</tr>
<tr>
<td>:q</td>
<td>&#x9000;&#x51FA;</td>
</tr>
<tr>
<td>:wq</td>
<td>&#x4FDD;&#x5B58;&#x9000;&#x51FA;</td>
</tr>
<tr>
<td>:x</td>
<td>&#x4FDD;&#x5B58;&#x9000;&#x51FA;</td>
</tr>
<tr>
<td>:w!</td>
<td>&#x5F3A;&#x5236;&#x4FDD;&#x5B58;</td>
</tr>
<tr>
<td>:q!</td>
<td>&#x5F3A;&#x5236;&#x9000;&#x51FA;&#xFF0C;&#x4E0D;&#x4FDD;&#x5B58;&#x4FEE;&#x6539;</td>
</tr>
<tr>
<td>:e!</td>
<td>&#x653E;&#x5F03;&#x4FEE;&#x6539;&#xFF0C;&#x6062;&#x590D;&#x5230;&#x4FEE;&#x6539;&#x4E4B;&#x524D;&#x7684;&#x72B6;&#x6001;</td>
</tr>
<tr>
<td>:w newfile</td>
<td>&#x6587;&#x4EF6;&#x53E6;&#x5B58;&#x4E3A;</td>
</tr>
<tr>
<td>:set nu[mber]</td>
<td>&#x663E;&#x793A;&#x884C;&#x53F7;</td>
</tr>
<tr>
<td>:set nonu[mber]</td>
<td>&#x9690;&#x85CF;&#x884C;&#x53F7;</td>
</tr>
<tr>
<td>:set tabstop=4</td>
<td>&#x8BBE;&#x7F6E;&#x4E00;&#x4E2A;tab&#x7F29;&#x8FDB;4&#x4E2A;&#x5B57;&#x7B26;</td>
</tr>
<tr>
<td>:set mouse=a</td>
<td>&#x542F;&#x7528;&#x9F20;&#x6807;&#x7684;&#x70B9;&#x51FB;&#x529F;&#x80FD;</td>
</tr>
<tr>
<td>[:]/&#x5185;&#x5BB9;</td>
<td>&#x67E5;&#x627E;&#x6307;&#x5B9A;&#x5185;&#x5BB9;&#xFF0C;n&#x4E0B;&#x7FFB;&#xFF0C;N&#x4E0A;&#x7FFB;</td>
</tr>
<tr>
<td>[:]?&#x5185;&#x5BB9;</td>
<td>&#x67E5;&#x627E;&#x6307;&#x5B9A;&#x5185;&#x5BB9;&#xFF0C;N&#x4E0B;&#x7FFB;&#xFF0C;n&#x4E0A;&#x7FFB;</td>
</tr>
<tr>
<td>:%s/&#x539F;&#x5185;&#x5BB9;/&#x65B0;&#x5185;&#x5BB9;/[g]</td>
<td>&#x6240;&#x6709;&#x884C;&#x5185;&#x5BB9;&#x66FF;&#x6362;&#xFF0C;g&#x8868;&#x793A;&#x5168;&#x5C40;(&#x9ED8;&#x8BA4;&#x53EA;&#x80FD;&#x66FF;&#x6362;&#x4E00;&#x884C;&#x4E2D;&#x7B2C;&#x4E00;&#x5904;)</td>
</tr>
<tr>
<td>:m,ns/&#x539F;&#x5185;&#x5BB9;/&#x65B0;&#x5185;&#x5BB9;/[g]</td>
<td>m&#x5230;n&#x884C;&#x5185;&#x5BB9;&#x66FF;&#x6362;&#xFF0C;g&#x7528;&#x6CD5;&#x540C;&#x4E0A;</td>
</tr>
<tr>
<td>&#x5149;&#x6807;&#x5B9A;&#x4F4D;</td>
<td></td>
</tr>
<tr>
<td>:n</td>
<td>&#x5C06;&#x5149;&#x6807;&#x5B9A;&#x4F4D;&#x5230;&#x7B2C;n&#x884C;&#xFF0C;n&#x8868;&#x793A;&#x884C;&#x53F7;</td>
</tr>
</tbody>
</table>
<ul>
<li>&#x82E5;&#x975E;&#x6B63;&#x5E38;&#x5173;&#x95ED;&#x4E86;vim&#xFF0C;&#x53EF;&#x80FD;&#x4F1A;&#x4EA7;&#x751F;&#x4E34;&#x65F6;&#x7684;&#x4EA4;&#x6362;&#x6587;&#x4EF6;&#xFF0C;&#x518D;&#x6B21;&#x6253;&#x5F00;&#x65F6;&#x4F1A;&#x51FA;&#x73B0;&#x7279;&#x5B9A;&#x7684;&#x754C;&#x9762;&#xFF0C;&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x63D0;&#x793A;&#x8FDB;&#x884C;&#x5185;&#x5BB9;&#x7684;&#x6062;&#x590D;&#x4EE5;&#x53CA;&#x4EA4;&#x6362;&#x6587;&#x4EF6;&#x7684;&#x5220;&#x9664;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x624B;&#x52A8;&#x5C06;&#x4EA4;&#x6362;&#x6587;&#x4EF6;&#x5220;&#x9664;&#xFF0C;&#x4E0B;&#x6B21;&#x5C31;OK&#x4E86;&#x3002;&#x4EA4;&#x6362;&#x6587;&#x4EF6;&#x65F6;&#x9690;&#x85CF;&#x7684;(ls -a)</li>
</ul>
<h3 id="&#x914D;&#x7F6E;">&#x914D;&#x7F6E;</h3>
<p>vim&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#xFF1A;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x540E;&#x7684;&#x914D;&#x7F6E;&#x662F;&#x4E34;&#x65F6;&#x7684;&#xFF0C;&#x5173;&#x95ED;&#x540E;&#x5C31;&#x5931;&#x6548;&#x4E86;&#x3002;</p>
<ul>
<li><p>&#x914D;&#x7F6E;&#x65B9;&#x6CD5;&#x4E00;&#xFF1A;</p>
<p>&#x76F4;&#x63A5;&#x4FEE;&#x6539; /etc/vim/vimrc&#x6587;&#x4EF6;&#x3002;&#xFF08;vim&#x5B89;&#x88C5;&#x597D;&#x4EE5;&#x540E;&#x7684;&#x9ED8;&#x8BA4;&#x914D;&#x7F6E;&#xFF0C;&#x4E0D;&#x63A8;&#x8350;&#xFF09;</p>
</li>
<li><p>&#x65B9;&#x6CD5;&#x4E8C;&#xFF1A;&#x81EA;&#x5DF1;&#x521B;&#x5EFA;&#x6587;&#x4EF6;&#x8FDB;&#x884C;&#x914D;&#x7F6E;</p>
<ul>
<li>&#x5728;&#x7528;&#x6237;&#x5BB6;&#x76EE;&#x5F55;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;.vimrc</li>
<li>&#x5C06;vim&#x76F8;&#x5173;&#x7684;&#x914D;&#x7F6E;&#x5199;&#x5728;&#x6587;&#x4EF6;&#x4E2D;</li>
<li>&#x82E5;&#x6587;&#x4EF6;&#x6CA1;&#x6709;&#x751F;&#x6548;&#xFF0C;&#x9700;&#x8981;&#x91CD;&#x65B0;&#x52A0;&#x8F7D;&#x4E00;&#x6B21;<code>source ~/.vimrc</code></li>
</ul>
</li>
</ul>
<pre><code class="lang-shell">set nocompatible &quot; &#x5173;&#x95ED; vi &#x517C;&#x5BB9;&#x6A21;&#x5F0F;
syntax on &quot; &#x81EA;&#x52A8;&#x8BED;&#x6CD5;&#x9AD8;&#x4EAE;
set number &quot; &#x663E;&#x793A;&#x884C;&#x53F7;
set cursorline &quot; &#x7A81;&#x51FA;&#x663E;&#x793A;&#x5F53;&#x524D;&#x884C;
set ruler &quot; &#x6253;&#x5F00;&#x72B6;&#x6001;&#x680F;&#x6807;&#x5C3A;
set shiftwidth=4 &quot; &#x8BBE;&#x5B9A; &lt;&lt; &#x548C; &gt;&gt; &#x547D;&#x4EE4;&#x79FB;&#x52A8;&#x65F6;&#x7684;&#x5BBD;&#x5EA6;&#x4E3A; 4
set softtabstop=4 &quot; &#x4F7F;&#x5F97;&#x6309;&#x9000;&#x683C;&#x952E;&#x65F6;&#x53EF;&#x4EE5;&#x4E00;&#x6B21;&#x5220;&#x6389; 4 &#x4E2A;&#x7A7A;&#x683C;
set tabstop=4 &quot; &#x8BBE;&#x5B9A; tab &#x957F;&#x5EA6;&#x4E3A; 4
set nobackup &quot; &#x8986;&#x76D6;&#x6587;&#x4EF6;&#x65F6;&#x4E0D;&#x5907;&#x4EFD;
set autochdir &quot; &#x81EA;&#x52A8;&#x5207;&#x6362;&#x5F53;&#x524D;&#x76EE;&#x5F55;&#x4E3A;&#x5F53;&#x524D;&#x6587;&#x4EF6;&#x6240;&#x5728;&#x7684;&#x76EE;&#x5F55;
filetype plugin indent on &quot; &#x5F00;&#x542F;&#x63D2;&#x4EF6;
set backupcopy=yes &quot; &#x8BBE;&#x7F6E;&#x5907;&#x4EFD;&#x65F6;&#x7684;&#x884C;&#x4E3A;&#x4E3A;&#x8986;&#x76D6;
set ignorecase smartcase &quot; &#x641C;&#x7D22;&#x65F6;&#x5FFD;&#x7565;&#x5927;&#x5C0F;&#x5199;&#xFF0C;&#x4F46;&#x5728;&#x6709;&#x4E00;&#x4E2A;&#x6216;&#x4EE5;&#x4E0A;&#x5927;&#x5199;&#x5B57;&#x6BCD;&#x65F6;&#x4ECD;&#x4FDD;&#x6301;&#x5BF9;&#x5927;&#x5C0F;&#x5199;&#x654F;&#x611F;
set nowrapscan &quot; &#x7981;&#x6B62;&#x5728;&#x641C;&#x7D22;&#x5230;&#x6587;&#x4EF6;&#x4E24;&#x7AEF;&#x65F6;&#x91CD;&#x65B0;&#x641C;&#x7D22;
set incsearch &quot; &#x8F93;&#x5165;&#x641C;&#x7D22;&#x5185;&#x5BB9;&#x65F6;&#x5C31;&#x663E;&#x793A;&#x641C;&#x7D22;&#x7ED3;&#x679C;
set hlsearch &quot; &#x641C;&#x7D22;&#x65F6;&#x9AD8;&#x4EAE;&#x663E;&#x793A;&#x88AB;&#x627E;&#x5230;&#x7684;&#x6587;&#x672C;
set noerrorbells &quot; &#x5173;&#x95ED;&#x9519;&#x8BEF;&#x4FE1;&#x606F;&#x54CD;&#x94C3;
set novisualbell &quot; &#x5173;&#x95ED;&#x4F7F;&#x7528;&#x53EF;&#x89C6;&#x54CD;&#x94C3;&#x4EE3;&#x66FF;&#x547C;&#x53EB;
set t_vb= &quot; &#x7F6E;&#x7A7A;&#x9519;&#x8BEF;&#x94C3;&#x58F0;&#x7684;&#x7EC8;&#x7AEF;&#x4EE3;&#x7801;
set showmatch &quot; &#x63D2;&#x5165;&#x62EC;&#x53F7;&#x65F6;&#xFF0C;&#x77ED;&#x6682;&#x5730;&#x8DF3;&#x8F6C;&#x5230;&#x5339;&#x914D;&#x7684;&#x5BF9;&#x5E94;&#x62EC;&#x53F7;
set matchtime=2 &quot; &#x77ED;&#x6682;&#x8DF3;&#x8F6C;&#x5230;&#x5339;&#x914D;&#x62EC;&#x53F7;&#x7684;&#x65F6;&#x95F4;
set magic &quot; &#x8BBE;&#x7F6E;&#x9B54;&#x672F;
set hidden &quot; &#x5141;&#x8BB8;&#x5728;&#x6709;&#x672A;&#x4FDD;&#x5B58;&#x7684;&#x4FEE;&#x6539;&#x65F6;&#x5207;&#x6362;&#x7F13;&#x51B2;&#x533A;&#xFF0C;&#x6B64;&#x65F6;&#x7684;&#x4FEE;&#x6539;&#x7531; vim &#x8D1F;&#x8D23;&#x4FDD;&#x5B58;
set guioptions-=T &quot; &#x9690;&#x85CF;&#x5DE5;&#x5177;&#x680F;
set guioptions-=m &quot; &#x9690;&#x85CF;&#x83DC;&#x5355;&#x680F;
set smartindent &quot; &#x5F00;&#x542F;&#x65B0;&#x884C;&#x65F6;&#x4F7F;&#x7528;&#x667A;&#x80FD;&#x81EA;&#x52A8;&#x7F29;&#x8FDB;
set backspace=indent,eol,start &quot;&#x4E0D;&#x8BBE;&#x5B9A;&#x5728;&#x63D2;&#x5165;&#x72B6;&#x6001;&#x65E0;&#x6CD5;&#x7528;&#x9000;&#x683C;&#x952E;&#x548C; Delete &#x952E;&#x5220;&#x9664;&#x56DE;&#x8F66;&#x7B26;
set cmdheight=1 &quot; &#x8BBE;&#x5B9A;&#x547D;&#x4EE4;&#x884C;&#x7684;&#x884C;&#x6570;&#x4E3A; 1
set laststatus=2 &quot; &#x663E;&#x793A;&#x72B6;&#x6001;&#x680F; (&#x9ED8;&#x8BA4;&#x503C;&#x4E3A; 1, &#x65E0;&#x6CD5;&#x663E;&#x793A;&#x72B6;&#x6001;&#x680F;)
set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\="" %0(%{&fileformat}\="" %{&encoding}\="" %c:%l="" %L%)\="" "="" 设置在状态行显示的信息="" set="" foldenable="" 开始折叠="" foldmethod="syntax" 设置语法折叠="" foldcolumn="0" 设置折叠区域的宽度="" setlocal="" foldlevel="1" 设置折叠层数为="" foldclose="all" 设置为自动关闭折叠="" nnoremap="" <space=""> @=((foldclosed(line(&apos;.&apos;)) &lt; 0) ? &apos;zc&apos; : &apos;zo&apos;)<CR> &quot; &#x7528;&#x7A7A;&#x683C;&#x952E;&#x6765;&#x5F00;&#x5173;&#x6298;&#x53E0;
</CR></%F[%1*%M%*%n%R%H]%=\></code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="./chapter03.html" class="navigation navigation-prev " aria-label="Previous page: 文件系统"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="./chapter05.html" class="navigation navigation-next " aria-label="Next page: 目录操作的常见指令"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="gitbook/app.js"></script>

    
    <script src="gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-copy-code-button/toggle.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"prism":{},"splitter":{},"copy-code-button":{},"toggle-chapters":{},"highlight":{},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
<!-- body:end -->
    </body>
    <!-- End of book Linux -->
<!-- End of book Linux -->
</html>
